package com.report.opportunity.api;

import com.report.opportunity.command.CreateOpportunityCommand;
import org.axonframework.commandhandling.gateway.CommandGateway;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.UUID;

@RestController
public class OpportunityApi {

    @Autowired
    private CommandGateway commandGateway;

    @PostMapping("/opportunity")
    public String createOppty(){
        return commandGateway.sendAndWait(new CreateOpportunityCommand(UUID.randomUUID().toString(), "a"));
    }
}
